package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.Maintenance;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/MaintenanceMapper.class */
public interface MaintenanceMapper {
    @Results(id = "map", value = {@Result(property = "createTime", column = "create_time"), @Result(property = "repairId", column = "repair_id")})
    @Select({"select m.*,u.name as orderUserName from  maintenance m left join repair r on m.repair_id = r.id left join user u on r.order_user_id = u.id where repair_id = #{id}"})
    Maintenance queryById(Integer num);

    @Insert({"insert into maintenance(create_time,address,content,consumables,repair_id)values(#{createTime},#{address},#{content},#{consumables},#{repairId})"})
    int insert(Maintenance maintenance);

    @Update({"<script>update maintenance <set><if test='createTime != null and createTime.length &gt; 0'>create_time = #{createTime},</if><if test='address != null and address.length &gt; 0'>address = #{address},</if><if test='content != null and content.length &gt; 0'>content = #{content},</if><if test='consumables != null and consumables.length &gt; 0'>consumables = #{consumables},</if><if test='repairId != null '>repair_id = #{repairId} </if></set>where id = #{id}</script>"})
    int update(Maintenance maintenance);

    @Delete({"delete from maintenance where id = #{id}"})
    int deleteById(Integer num);
}